<template>
  <div>
    <el-form
      :inline="true"
      :model="formInline"
      ref="formInline"
      class="demo-form-inline"
      style="float: left"
    >
      <el-form-item label="系统模块">
        <el-input v-model="formInline.systemModule"></el-input>
      </el-form-item>

      <el-form-item label="操作类型">
        <el-select v-model="formInline.isDelete" placeholder="请选择活动区域">
          <el-option label="请选择" value=""></el-option>
          <el-option label="成功" value="true"></el-option>
          <el-option label="失败" value="flase"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="活动时间">
        <el-col :span="11">
          <el-date-picker
            type="date"
            placeholder="选择日期"
            v-model="formInline.station"
            style="width: 100%"
          ></el-date-picker>
        </el-col>
        <el-col class="line" :span="2">-</el-col>
        <el-col :span="11">
          <el-date-picker
            type="date"
            placeholder="选择日期"
            v-model="formInline.enddate"
            style="width: 100%"
          ></el-date-picker>
        </el-col>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="load">查询</el-button>
      </el-form-item>
    </el-form>

    <template>
      <el-table
        ref="multipleTable"
        :data="tableData"
        tooltip-effect="dark"
        style="width: 100%"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column prop="id" label="序号" width="120"> </el-table-column>
        <el-table-column
          prop="logNum"
          label="日志编号"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="systemModule"
          label="系统模块"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="operationType"
          label="操作类型"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="requestMode"
          label="请求方式"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="person"
          label="操作人员"
          width="120"
        ></el-table-column>
        <el-table-column prop="host" label="主机" width="120"></el-table-column>
        <el-table-column
          prop="operationPlace"
          label="操作地点"
          width="120"
        ></el-table-column>
        <el-table-column label="操作状态" width="120">
          <template slot-scope="scope">
            <span v-if="(scope.row.isDelete = true)">成功</span>
            <span v-else>失败</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="operationDate"
          label="操作时期"
          width="120"
        ></el-table-column>
        <el-table-column label="操作" width="120"></el-table-column>
      </el-table>
    </template>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="formInline.pageIndex"
      :page-sizes="[2, 4, 6, 8]"
      :page-size="formInline.pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="count"
    >
    </el-pagination>
  </div>
</template>
<script>
import { getOperationLogapi } from "@/api/logManage/logManag";
export default {
  data() {
    return {
      formInline: {
        pageIndex: 1,
        pageSize: 2,
        systemModule: "",
        isDelete: "",
        station: "",
        enddate: "",
      },
      count: 0,
      tableData: [],
      multipleSelection: [],
    };
  },
  created() {
    this.load();
  },
  methods: {
    load() {
      getOperationLogapi(this.formInline).then((res) => {
        this.tableData = res.data.data;
        this.count = res.data.totalCount;
      });
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    handleSizeChange(val) {
      this.formInline.pageSize = val;
      this.load();
    },
    handleCurrentChange(val) {
      this.formInline.pageIndex = val;
      this.load();
    },
  },
};
</script>